<!DOCTYPE html>
<html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" layout:decorate="~{layout}">
<body id="cas">
<main role="main" class="container mt-3 mb-3">
    <div layout:fragment="content" id="login">

        <div id="mainPanel" class="mdc-card p-4 m-auto w-lg-50">
            <h2 th:utext="#{screen.processing.title}"></h2>
            <p th:utext="#{screen.processing.text}"></p>
            <div role="progressbar" class="mdc-linear-progress mdc-linear-progress--indeterminate">
                <div class="mdc-linear-progress__buffer">
                    <div class="mdc-linear-progress__buffer-bar"></div>
                    <div class="mdc-linear-progress__buffer-dots"></div>
                </div>
                <div class="mdc-linear-progress__bar mdc-linear-progress__primary-bar">
                    <span class="mdc-linear-progress__bar-inner"></span>
                </div>
                <div class="mdc-linear-progress__bar mdc-linear-progress__secondary-bar">
                    <span class="mdc-linear-progress__bar-inner"></span>
                </div>
            </div>

            <form method="post" id="fm1">
                <input type="hidden" name="execution" th:value="${flowExecutionKey}" />
                <input type="hidden" name="_eventId" value="continue" />
                <input type="hidden" id="sessionStorage" name="sessionStorage"/>
                <input type="submit" style="display: none" />
            </form>
        </div>
        
        <script>new mdc.linearProgress.MDCLinearProgress(document.querySelector('.mdc-linear-progress'));</script>
        <script th:inline="javascript">
            /*<![CDATA[*/

            let sessionStorageContext = /*[[${sessionStorageContext}]]*/;
            if (sessionStorageContext === undefined || sessionStorageContext === null || sessionStorageContext === "") {
                sessionStorageContext = "sessionStorage";
            }
            
            const payload = readFromSessionStorage(sessionStorageContext);
            document.getElementById("sessionStorage").value = payload;
            document.getElementById("fm1").submit();
            /*]]>*/
        </script>

        <noscript>
            <p>
                <style type="text/css">
                    #mainPanel {display:none;}
                </style>
            <div class="mdc-card p-4 m-auto w-lg-50 banner banner-danger alert alert-danger text-justify">
                <h2 th:utext="#{screen.browser.js.disabled.title}"></h2>
                <p class="intro" th:utext="#{screen.browser.js.disabled.text}"></p>
            </div>
            </p>
        </noscript>
    </div>
</main>
</body>
</html>
